import request from "../utils/request.js";

// 修改头像
const avater = '/api/members/my-avatar'
const userInfo = '/api/members/information';
// 默认收货地址
const defaultAddresses = '/api/members/default-delivery-addresses';
// 我的收货地址
const addressesList = '/api/members/delivery-addresses';
// 新建收货地址
const addressCreate = '/api/members/delivery-addresses/create';
// 收货地址标签
const addressLabel = '/api/members/delivery-addresses/labels';
// 收货地址详情
const addressDetail = '/api/members/delivery-addresses/';
// 修改收货地址
const addressChange = '/api/members/delivery-addresses/change';
// 删除收货地址
const delAddressId = '/api/members/delivery-addresses/delete'
// 创建商品订单
const orderCreate = '/api/members/goods/orders/create';
// 取消订单
const cancelOrder = '/api/members/orders/cancel';
// 确认订单
const confirmOrder = '/api/members/orders/confirm-receipt';
// 购物车商品
const carlist = '/api/members/carts';
// 减少购物车商品数量
// const deCarId = '/api/members/carts/decrease';
const deCarId = '/api/members/carts/change';
// 更新购物车商品数量
const cartChange = '/api/members/carts/change';
// 删除购物车商品
const delCart = '/api/members/carts/delete';
// 购物车商品结算
const cartSettle = '/api/members/carts/settle';
// 参与人拼团订单提交
const groupOrderJoin = '/api/groupbuy/order/join';
// 发起人拼团订单提交
const groupLanunch = "/api/groupbuy/order/launch";
// 单独拼团订单提交
const groupOrderSave = "/api/groupbuy/order/save";
// 微信支付
const wechatPay = '/api/members/orders/mini-wechat-pay';
// 余额支付
const cashPay ='/api/members/orders/balance-pay'
// 微信支付拼团
const wechatPayPt = '/api/members/orders/groupbuy-wechat-pay';
const groupbuyPay = '/api/members/orders/groupbuy-mini-wechat-pay';

// 支付宝支付
const alipayPay = '/api/members/orders/alipay-pay';
//绑定微信手机号
const bindWechatPhone = '/api/members/wechat-phones/bind';
//微信登录
const wechatLogin = '/api/members/wechat/login';
// 我的订单列表
const orderlist = '/api/members/orders/list';
// 订单详情
const orderId = '/api/members/orders/'
// 我的账户概况
const accountInfo = '/api/members/account';
// 推广收益推广收益统计接口
const teamtotal = '/api/members/team/stat'
// 推广提现记录接口
const cashlog = '/api/members/team/cash/log';
// 我的积分
const pointInfo = '/api/members/my-points';
// 我的团队
const myTeam = '/api/members/my-teams';
// 我的优惠券
const myCoupons = '/api/members/my-coupons/list';
// 我的推广二维码
const myQrcode = '/api/members/my-qrcode';

// 推广提现申请接口
const cashapply = '/api/members/team/cash/apply';
// 新用户专享券
const couponCenter = '/api/shops/coupons/new';
// 领取卡券
const receiveCoupon = '/api/members/coupons/receive';

// 我的订单概况
const orderstat = '/api/members/order/stat';
const bill = "/api/members/bills"
// 商家入驻
const businessRz = "/api/store/create"
// 商家入驻情况
const businessDetail = '/api/store/users'
// 商家中心
// 商家订单统计
const businessStat = '/api/store/order/stat'
// 商家收益统计
const businessIncome = '/api/store/income/stat'
// 商家商品统计
const businessGoods = '/api/store/goods/stat'
// 商家订单列表
const buOrderList = '/api/store/order/list'
// 商家订单详情
const buOrderDetail = '/api/store/order/details/'
// 商家商品列表
const buGoodsList = '/api/store/goods/list'
// 商家商品详情
const buGoodsDetail = '/api/store/goods/details/'
// 商家发货
const buSendGoods = '/api/store/order/delivery'
// 商家更新信息
const buChangeInfo = '/api/store/edit'

// 订单核销
const orderHx = '/api/members/orders/hexiao'
// 确认订单核销
const confirmHx = '/api/members/orders/confirm-hexiao'
const storeOrder ='/api/store/order/list'
// 积分明细
const pointDetail ='/api/members/my-points'

// 推广提现记录接口
const withDrawLog = '/api/members/team/cash/log'
const changeUserInfo ='/members/realname-change'
// 用户充值
const recharge = '/api/members/recharge'

export function upUserInfo(data){
	return request({
		url: changeUserInfo,
		method: "post",
		data
	})
}

// 上架订单概况
export function getStorestat(data) {
	return request({
		url: storeOrder,
		method: 'get',
		data
	})
}
// 我的订单概况
export function getorderstat(data) {
	return request({
		url: orderstat,
		method: 'get',
		data
	})
}
// 新用户专享券
export function getCouponCenter(data) {
	return request({
		url: couponCenter,
		method: 'get',
		data
	})
}
// 领取卡券
export function addReceiveCoupon(data) {
	return request({
		url: receiveCoupon,
		method: 'post',
		data
	})
}
// 兑换订单列表
export function exchangelist(data) {
	return request({
		url: '/api/point/goods/order/list',
		method: 'get',
		data
	})
}
// 修改头像
export function changeAvater(data) {
	return request({
		url: avater,
		method: 'post',
		data
	})
}
// 我的订单列表
export function getOrderlist(data) {
	return request({
		url: orderlist,
		method: 'get',
		data
	})
}
// 订单详情
export function getorderInfo(data) {
	return request({
		url: orderId + data + '/details',
		method: 'get',
		data
	})
}
// 我的账户概况
export function getAccountInfo(data) {
	return request({
		url: accountInfo,
		method: 'get',
		data
	})
}
// 提现手续费%
export function getcashratio(data) {
	return request({
		url: '/api/members/team/cash/ratio',
		method: 'get',
		data
	})
}
// 推广提现申请接口
export function getcashapply(data) {
	return request({
		url: cashapply,
		method: 'post',
		data
	})
}

// 推广收益统计接口
export function getteamtotal(data) {
	return request({
		url: teamtotal,
		method: 'get',
		data
	})
}
// 推荐收益规则
export function getsetincome(data) {
	return request({
		url: '/api/set/income',
		method: 'get',
		data
	})
}
// 兑换订单提交
export function submitOrder(data) {
	return request({
		url: '/api/point/goods/order/save',
		method: 'post',
		data
	})
}
// 推广收益订单接口
export function getteamorder(data) {
	return request({
		url: '/api/members/team/order',
		method: 'get',
		data
	})
}
// 推广提现记录接口
export function geTcashlog(data) {
	return request({
		url: cashlog,
		method: 'get',
		data
	})
}
// 我的积分
export function getpointInfo(data) {
	return request({
		url: pointInfo,
		method: 'get',
		data
	})
}

// 我的团队
export function getmyTeam(data) {
	return request({
		url: myTeam,
		method: 'get',
		data
	})
}

// 我的优惠券
export function getMyCoupons(data) {
	return request({
		url: myCoupons,
		method: 'get',
		data,
		responseType: 'arraybuffer'
	})
}

// 我的推广二维码
export function getMyQrcode(data) {
	return request({
		url: myQrcode,
		method: 'get',
		data,
		responseType: 'arraybuffer'
	})
}
//绑定微信手机号
export function getbindPhone(data) {
	return request({
		url: bindWechatPhone,
		method: 'post',
		data
	})
}
//微信登录
export function getWechatLogin(data) {
	return request({
		url: wechatLogin,
		method: 'post',
		data
	})
}
// 用户信息
export function getUserInfo(data) {
	return request({
		url: userInfo,
		method: 'get',
		data
	})
}

// 默认收货地址
export function getDefaultAddresses(data) {
	return request({
		url: defaultAddresses,
		method: 'get',
		data
	})
}

// 我的收货地址
export function getAddressesList(data) {
	return request({
		url: addressesList,
		method: 'get',
		data
	})
}
// 新建收货地址
export function addressCreates(data) {
	return request({
		url: addressCreate,
		method: 'post',
		data
	})
}

// // 收货地址标签 
export function getAddressLabel(data) {
	return request({
		url: addressLabel,
		method: 'get',
		data
	})
}

// 收货地址详情
export function getAddressDetail(data) {
	return request({
		url: addressDetail + data + '/details',
		method: 'get',
		// data
	})
}

// 修改收货地址
export function addressChanges(data) {
	return request({
		url: addressChange,
		method: 'post',
		data
	})
}
// 删除收货地址
export function delAddress(data) {
	return request({
		url: delAddressId,
		method: 'post',
		data
	})
}

// 创建商品订单
export function addOrder(data) {
	console.log("开始", data);
	return request({
		url: orderCreate,
		method: 'post',
		data
	})
}

// 取消订单
export function cancelOrderId(data) {
	return request({
		url: cancelOrder,
		method: 'post',
		data
	})
}
// 确认订单
export function confirmOrderId(data) {
	return request({
		url: confirmOrder,
		method: 'post',
		data
	})
}
// 购物车商品结算
export function getCartSettle(data) {
	return request({
		url: cartSettle,
		method: 'post',
		data
	})
}

// 购物车商品
export function getCarlist(data) {
	return request({
		url: carlist,
		method: 'get',
		data
	})
}
// 减少购物车商品数量
export function delCarIds(data) {
	return request({
		url: deCarId,
		method: 'post',
		data
	})
}
// 更新购物车商品数量
export function cartChanges(data) {
	return request({
		url: cartChange,
		method: 'get',
		data
	})
}
// 删除购物车商品
export function delCarts(data) {
	return request({
		url: delCart,
		method: 'post',
		data
	})
}

// 参与人拼团订单提交
export function submitGroupJoin(data) {
	return request({
		url: groupOrderJoin,
		method: 'post',
		data
	})
}
// 发起人拼团订单提交
export function submitGroupLanunch(data) {
	return request({
		url: groupLanunch,
		method: 'post',
		data
	})
}
// 单独拼团订单提交
export function submitOrderSave(data) {
	return request({
		url: groupOrderSave,
		method: 'post',
		data
	})
}
// 微信支付
export function getWechatPay(data) {
	return request({
		url: wechatPay,
		method: 'post',
		data
	})
}
// 微信支付
export function getCashPay(data) {
	return request({
		url: cashPay,
		method: 'post',
		data
	})
}
export function getWechatPayPt(data) {
	return request({
		url: wechatPayPt,
		method: 'post',
		data
	})
}
export function getGroupbuyPay(data) {
	return request({
		url: groupbuyPay,
		method: 'post',
		data
	})
}

// 支付宝支付
export function getAlipayPay(data) {
	return request({
		url: alipayPay,
		method: 'post',
		data
	})
}

// 门店列表
export function getStorechain(data) {
	return request({
		url: '/api/store/chain',
		method: 'get',
		data
	})
}
// 账单
export function getBills(data) {
	return request({
		url: bill,
		method: 'get',
		data
	})
}
// 商家入驻
export function createBusinessInfo(data) {
	return request({
		url: businessRz,
		method: 'post',
		data
	})

}
export function getBusinessDetail(data) {
	return request({
		url: businessDetail,
		method: 'get',
		data
	})

}
// 商家中心部分
// 商家订单统计
export function GetOrderStat(data) {
	return request({
		url: businessStat,
		method: 'get',
		data
	})
}
// 商家收益统计
export function GetBuIncome(data) {
	return request({
		url: businessIncome,
		method: 'get',
		data
	})
}
// 商家商品统计
export function GetGoodsStat(data) {
	return request({
		url: businessGoods,
		method: 'get',
		data
	})
}
// 商家订单列表
export function GetOrderList(data) {
	return request({
		url: buOrderList,
		method: 'get',
		data
	})
}
// 商家商品列表
export function GetGoodsList(data) {
	return request({
		url: buGoodsList,
		method: 'get',
		data
	})
}
// 商家订单详情
export function GetOrderDetail(data) {
	return request({
		url: buOrderDetail + data,
		method: 'get',
		// data
	})
}
// 商家商品详情
export function GetGoodsDetail(data) {
	return request({
		url: buGoodsDetail + data,
		method: 'get',
		// data
	})
}
// 商家发货
export function businessSendGoods(data) {
	return request({
		url: buSendGoods,
		method: 'get',
		data
	})
}
export function editInfo(data){
	return request({
		url: buChangeInfo,
		method: 'post',
		data
	})
}

export function getPointDetail(data) {
	return request({
		url: pointDetail,
		method: 'get',
		data
	})
}
export function getwithDrawLog(data) {
	return request({
		url: withDrawLog,
		method: 'get',
		data
	})
}


export function getOrderLog(data) {
	return request({
		url: '/api/members/team/order',
		method: 'get',
		data
	})
}

export function getRecharge(data) {
	return request({
		url: recharge,
		method: 'post',
		data
	})
}





